// components/navigation-bar/navigation-bar.js

const App = getApp();

Component({

  options: {
    addGlobalClass: true,
  },
  externalClasses: ['custom-class'],

  /**
   * 组件的属性列表
   */
  properties: {
    pageName:String,
    showNav:{
      type:Boolean,
      value:false
    },
    bgColor:{
      type:String,
      value:'#fff'
    },
    customBackEvent:{
      type:Boolean,
      value:false
    }

  },

  /**
   * 组件的初始数据
   */
  data: {

  },
  lifetimes: {
    attached: function () {
      this.setData({
        navHeight: App.globalData.navHeight,
        navTop: App.globalData.navTop
      })
    }
  },
  /**
   * 组件的方法列表
   */
  methods: {
    //回退
    _action_navBack: function (event) {
      if(this.data.customBackEvent){
        this.triggerEvent('backEvent', event, "mybackEvent")
        return;
      }
      wx.navigateBack({
        delta: 1
      })
    },
  }
})
